//
//  MineSettingViewController.m
//  ArtDog
//
//  Created by dllo on 16/8/30.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "MineSettingViewController.h"
#import "MineSettingTableCell.h"
#import "MineMainViewController.h"
#import "BaseTableView.h"
#import "HLMacro.h"

@interface MineSettingViewController ()
@property (weak, nonatomic) IBOutlet BaseTableView *tableView;
@property (nonatomic, strong) NSArray *dataArray;

@end

@implementation MineSettingViewController

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    
}

- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
    
}

- (void)viewDidLoad {
    [super viewDidLoad];
    [self handleData];
    [self setupBasic];
    [self tableViewProcotol];
}

- (void)handleData
{
    _dataArray = @[@"消息推送", @"意见反馈", @"清空缓存", @"关于艺术狗"];
}

- (void)setupBasic
{
    [_tableView registerNib:[UINib nibWithNibName:@"MineSettingTableCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:@"mineSettingTableCell"];
}

- (void)tableViewProcotol
{
    [_tableView tableViewWithNumberOfRow:^(UITableView * _Nonnull tableView, TableViewReturnParam * _Nonnull tableViewParam) {
        tableViewParam.numberOfRow = _dataArray.count;
    } andCellForRowAtIndexPath:^(UITableView * _Nonnull tableView, NSIndexPath * _Nonnull indexPath, TableViewReturnParam * _Nonnull tableViewParam) {
        MineSettingTableCell *cell = [tableView dequeueReusableCellWithIdentifier:@"mineSettingTableCell"];
        
        [cell setCellWithModelString:_dataArray[indexPath.row]];
        tableViewParam.returnCell = cell;
    } andHeightForrowAtIndexPath:^(UITableView * _Nonnull tableView, NSIndexPath * _Nonnull indexPath, TableViewReturnParam * _Nonnull tableViewParam) {
        tableViewParam.heightAtRow = 44;
    } andDidSelectRowAtIndexPath:^(UITableView * _Nonnull tableView, NSIndexPath * _Nonnull indexPath) {
        
    }];
}


- (IBAction)backAction:(id)sender {
    [self.navigationController popViewControllerAnimated:YES];
}

- (IBAction)exitLoginAction:(id)sender {
    MineMainViewController *mainVC = [[MineMainViewController alloc]initWithNibName:@"MineMainViewController" bundle:[NSBundle mainBundle]];
    mainVC.isExitLogin = YES;
    self.hidesBottomBarWhenPushed = NO;
    [[NSUserDefaults standardUserDefaults]setObject:@{@"id": @"0", @"token": @"df68e038-143e-41cb-b554-456f78f184fc", @"phoneNumber": @"0", @"password": @"0"} forKey:kUserDefaultPathKey];
    self.navigationController.viewControllers = @[mainVC];
    
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    
}

@end
